
#ifndef CombatSysStateIf_H
#define CombatSysStateIf_H

#include "Entry/LibExportCom.h"
#include "Move/MoveDefinition.h"
#include "Combat/CombatDefinition.h"
#include "Entity/EntityDefinition.h"

class IEvt;
class CombatSysImp;
class IEntity;

/*
*
*	CombatState Interface

*	Combat State:
*	state Peace:		no combat
*	state Ready:		in combat, ready for casting a spell to its target
*	state Casting:		in combat, casting a spell on its target
*	state CoolDown:		in combat, cool down time interval just after a previous spell is casted
*	state Forbidden:	in combat, forbidden to cast a spell
*	state Charging:		in combat, approaching to its target for casting a spell
*/
class TCOM_API  ICombatState
{
public:
	ICombatState()
		:m_nTTL(0),
		m_wpEntity(NULL),
		m_wpCombat(NULL)
	{}
	virtual ~ICombatState(){;}

	//
	//
	void init(CombatSysImp* pCombat, IEntity* pEntity)
	{
		m_wpCombat = pCombat;
		m_wpEntity = pEntity;
	}

	// 
	//	Fire when enter a new state
	//
	virtual void enter() = 0;

	// 
	//	Fire just before leaving a state
	//
	virtual void leave() = 0;

	// 
	//	update in current state
	//
	virtual bool update(int nElapse) = 0;

	// 
	//	onEvent callback in current state
	//
	virtual void onEvent(IEvt& evt) = 0;
protected:
	int				m_nTTL;	//	Time To Live
	CombatSysImp*	m_wpCombat;
	IEntity*		m_wpEntity;
};




#endif // CombatSys_H
